package com.osgix.authorize.dao.impl;

import org.springframework.stereotype.Repository;

import com.osgix.authorize.dao.UserInfoDao;
import com.osgix.authorize.model.UserInfo;
import com.osgix.common.orm.ibatis.AbsEntityDao;

@Repository("userInfoDao")
public class UserInfoDaoImpl extends AbsEntityDao<UserInfo, java.lang.Long> implements UserInfoDao {

	@Override
	public String getIbatisMapperNamesapce() {
		return "UserInfo";
	}

	public void saveOrUpdate(UserInfo userInfo) {
		if (userInfo.getUserInfoId() == null)
			save(userInfo);
		else
			update(userInfo);
	}

	public UserInfo getByLoginAccount(java.lang.String loginAccount) {
		return (UserInfo) getIbatisTemplate().selectOne("UserInfo.getByLoginAccount", loginAccount);
	}

	public int deleteByLoginAccount(java.lang.String loginAccount) {
		return getIbatisTemplate().delete("UserInfo.deleteByLoginAccount", loginAccount);
	}

}
